package com.cskaoyan.controller.admin;

import com.cskaoyan.bean.BasePageData;
import com.cskaoyan.bean.BaseParam;
import com.cskaoyan.bean.BaseRespVo;
import com.cskaoyan.bean.Comment;
import com.cskaoyan.service.CommentService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("admin/comment")
public class CommentController {
    @Autowired
    CommentService commentService;


    @RequiresPermissions("admin:comment:list")
    @RequestMapping("list")
    public BaseRespVo list(Integer userId , Integer valueId , BaseParam param){

        BasePageData basePageData = commentService.selectComment(userId , valueId , param);

        return BaseRespVo.ok(basePageData);

    }
    @RequiresPermissions("admin:comment:delete")
    @PostMapping("delete")
    public BaseRespVo delete(@RequestBody Comment comment){

        commentService.deleteComment(comment);
        return BaseRespVo.ok();
    }
}
